// Copyright [2020] <unknown>
#include <bits/stdc++.h>
using namespace std;
// #define ONLINE_JUDGE
#ifndef ONLINE_JUDGE
#define dbg(x...) { cerr << "\033[32;1m" << #x << " -> "; err(x); }
void err() { cerr << "\033[39;0m" << endl; }
template<typename T, typename... A>
void err(T a, A... x) { cerr << a << ' '; err(x...); }
#else
#define dbg(...)
#endif

#define sz(x) ((int)x.size())

typedef long long LL;

const int N = 8e6+50, MOD = 998244353;

LL mask[50];

inline LL s(LL n) {
    LL ans = 0, t = 1;
    while (n) {
        ans += (n-n/2)*t;
        n /= 2;
        t *= 2;
    }
    return ans;
}

int main(int argc, char const *argv[]) {
    // code
    LL n;
    cin >> n;
    LL ans = 0;
    mask[0] = (1LL<<50)-1;
    for (int i=1; i<50; ++i)
        mask[i] = mask[i-1] ^ (1LL<<i);

    // dbg(mask[0], mask[1]);
    for (LL l=1, r, v; l<=n; l=r+1) {
        v = n / l;
        r = n / v;
        ans = (ans + (s(r) - s(l-1))*v)%MOD;
    }
    ans = (ans%MOD+MOD)%MOD;
    cout << ans << endl;
    return 0;
}
